class Commodity {
    /**
     * 根据商品类别Id查询12条商品
     * @param ids 类别Id
     * @return {Promise<string>} JSON
     */
    moreCommodity(ids) {
        return new Promise((resolve, reject) => {
            $.ajax({
                url: "/www.xiaomi.com/more/commodity",
                method: "GET",
                data: {
                    ids: ids
                },
                success: function (response) {
                    resolve(response);
                },
                error: function (error) {
                    reject(error);
                }
            });
        });
    }

    /**
     * 根据商品名称或商品类别Id查询6条商品
     * @param data 【1,'xxx'】根据商品名称查询 【2,12】根据类别商品Id查询
     * @return {Promise<unknown>} JSON
     */
    navigationBarCommodity(data) {
        return new Promise((resolve, reject) => {
            $.ajax({
                url: "/www.xiaomi.com/navigation/bar/commodity",
                method: "GET",
                data: {
                    data: data
                },
                success: function (response) {
                    resolve(response);
                },
                error: function (error) {
                    reject(error);
                }
            });
        });
    }

    /**
     * 根据商品类别Id查询8条商品
     * @param id 商品Id
     * @return {Promise<unknown>} JSON
     */
    productCategory(id) {
        return new Promise((resolve, reject) => {
            $.ajax({
                url: "/www.xiaomi.com/product/category",
                method: "GET",
                data: {
                    id: id
                },
                success: function (response) {
                    resolve(response);
                },
                error: function (error) {
                    reject(error);
                }
            });
        });
    }
}